/*
 * Filename:    HcpmsWarnBaseForm.java
 * Copyright:   2014 中国平安保险（集团）股份有限公司 版权所有
 * Company:     平安科技养老险及健康险系统开发部
 * Create at:   2014-12-15
 */
package com.paic.mhis.hcpms.warning.web.vo;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class WarnBaseFormVO {
	public static final String DATE_FORMAT = "yyyy-MM-dd";
	public static final int WEEK_DAY = 7;
	private String userId;
	private String userName;
	private String areaCode;
	private String areaName;
	private String today;
	private String monthFirst;
	private String monthLast;
	private String feedbackDate;
	private String warnInscribe;
	private String regionName;

	public WarnBaseFormVO() {

	}

	public WarnBaseFormVO(int feelbackN) {
		SimpleDateFormat sft = new SimpleDateFormat(DATE_FORMAT);
		Date date = new Date();
		try {
			today = sft.format(date);
			SimpleDateFormat sftMonth = new SimpleDateFormat("yyyy-MM");
			monthFirst = sftMonth.format(date) + "-01";
			Calendar cal = Calendar.getInstance();
			cal.setTime(sft.parse(monthFirst));
			cal.add(Calendar.MONTH, 1);
			date = new Date(cal.getTime().getTime() - 60 * 60 * 100 * 24);
			monthLast = sft.format(date);
			date = new Date(sft.parse(today).getTime() + 60 * 60 * 100 * 24 * feelbackN);
			feedbackDate = sft.format(date);
		} catch (ParseException e) {
			e.printStackTrace();
		}

	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	public String getAreaName() {
		return areaName;
	}

	public void setAreaName(String areaName) {
		this.areaName = areaName;
	}

	public String getToday() {
		return today;
	}

	public void setToday(String today) {
		this.today = today;
	}

	public String getMonthFirst() {
		return monthFirst;
	}

	public void setMonthFist(String monthFirst) {
		this.monthFirst = monthFirst;
	}

	public String getMonthLast() {
		return monthLast;
	}

	public void setMonthLast(String monthLast) {
		this.monthLast = monthLast;
	}

	public String getFeedbackDate() {
		return feedbackDate;
	}

	public void setFeedbackDate(String feedbackDate) {
		this.feedbackDate = feedbackDate;
	}

	public String getWarnInscribe() {
		return warnInscribe;
	}

	public void setWarnInscribe(String warnInscribe) {
		this.warnInscribe = warnInscribe;
	}

	public String getRegionName() {
		return regionName;
	}

	public void setRegionName(String regionName) {
		this.regionName = regionName;
	}

	public static Date setDateToNDay(Date date, int n) {
		Calendar cal = Calendar.getInstance();
		cal.setTime(date);
		for (int i = 0; i < n; i++) {
			cal.add(Calendar.DATE, 1);
			while (cal.get(Calendar.DAY_OF_WEEK) == 1 || cal.get(Calendar.DAY_OF_WEEK) == 7) {
				cal.add(Calendar.DATE, 1);
			}
		}
		return cal.getTime();
	}

}
